﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smartec.Accounts.Camel.AMS.Model.Entities;
using Smartec.Accounts.Camel.AMS.Model.Repository;

namespace Smartec.Accounts.Camel.AMS.Model.Facades
{
   public static class ArticleFacade
    {
       public static void AddArticle(Article Article)
       {
           ArticleRepository.AddArticle(Article);
          
       }

       public static List<Article> GetAllArticle()
       {
           return ArticleRepository.All();
       }

       public static Article GetArticleById(int id)
       {
           return ArticleRepository.All().FirstOrDefault(t => t.ID == id);
       }
       public static void Save()
       {
           ArticleRepository.Save();
       }
       public static void UpdateArticle(Article Article)
       {
           var _Article = GetArticleById(Article.ID);
           _Article.Name = Article.Name;
           _Article.Body = Article.Body;
       }

       public static void DeleteArticleById(int id)
       {
           ArticleRepository.DeleteArticleById(id);
       }
    }
}
